<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Menu extends CI_Controller {

    function __construct (){
	    parent::__construct();
    }

	public function index()
	{
		$this->load->helper('common');
		$this->load->library('TokenStub');
		$this->load->library('MenuStub');
		
		$menuData = '
		 {
			 "button":[
			 {	
				  "type":"view",
				  "name":"首页",
				  "url":"http://luoma.ichaoqing.cn"
			  },
			  {
				   "type":"click",
				   "name":"歌手",
				   "key":"V1001_TODAY_SINGER"
			  },
			  {
				   "name":"菜单",
				   "sub_button":[
				   {	
					   "type":"view",
					   "name":"搜索",
					   "url":"http://www.soso.com/"
					},
					{
					   "type":"view",
					   "name":"视频",
					   "url":"http://v.qq.com/"
					},
					{
					   "type":"click",
					   "name":"赞一下我们",
					   "key":"V1001_GOOD"
					}]
			   }]
		 }		
		';
		$ret = MenuStub::create($menuData);
		if(false === $ret) {
			echo "create menu fail!\n";
		} else {
			echo "create menu success!\n";
		}

	}
}
